#include <pspkernel.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <pspgu.h>
#include <pspgum.h>
#include <pspdisplay.h>

#include <oslib/oslib.h>

PSP_MODULE_INFO("Blox 2", 0, 1, 0);
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU);
PSP_HEAP_SIZE_KB(-2024);

/* old psp macros */
#define min(x, y) (((x)>(y))?(y):(x))
#define WIDTH 480
#define HEIGHT 272
#define BUF_WIDTH (512)
#define SCR_WIDTH (480)
#define SCR_HEIGHT (272)
#define PIXEL_SIZE (4)
#define FRAME_SIZE (BUF_WIDTH * SCR_HEIGHT * PIXEL_SIZE)
#define ZBUF_SIZE (BUF_WIDTH SCR_HEIGHT * 2)
#define printf pspDebugScreenPrintf

/*Wait; will pause the screen for 3 seconds*/
#define Wait sceKernelDelayThread(3000000);

/*Wait; will pause the screen for 0.5 seconds*/
#define hWait sceKernelDelayThread(500000);

/* sprite macros */
#define NOT_MOVING 0
#define RIGHT 32
#define LEFT 64
#define ATTACKING_RIGHT 96
#define ATTACKING_LEFT 128
#define HURT_RIGHT 160
#define HURT_LEFT 192

#define ENEMY_RIGHT 0
#define ENEMY_LEFT 32
#define ENEMY_HURT_RIGHT 64
#define ENEMY_HURT_LEFT 96

/* pure sprite macros *programmed not actual image* */
#define FACING_RIGHT 1
#define FACING_LEFT 0
#define STILL 2

/* image name macros */
#define DEFAULT 100
#define ZOMBIE 101
#define YELLOW_ENEMY 102
#define GREEN_ENEMY 103
    
#define EXIT 0
#define ACTIVE 1
#define CONTINUE 2

/* bullet name macros */
#define DEFAULT_0 0
#define DEFAULT_1 1
#define DEFAULT_2 2
#define DEFAULT_3 3

/* redefing type for better compatibility and readability */
typedef OSL_IMAGE IMAGE;
typedef OSL_SOUND SOUND;
typedef OSL_FONT FONT;

/* ***************** GLOBALS ***************** */
static SOUND *select, *menu_music, *block, *jump, *rush;
static FONT  * italic, *normal, *bold;
static const int GROUND = 251;
static const int MAX_WAVES = 3;
int numOfEnemies = 0;
int equippedWeapon = DEFAULT_0;
/* ***************** GLOBALS ***************** */

enum colors 
{
    RED          = 0xFF0000FF,
	GREEN        = 0xFF00FF00,
	BLUE         = 0xFFFF0000,
	WHITE        = 0xFFFFFFFF,
	LIGHTGRAY    = 0xFFBFBFBF,
	GRAY         = 0xFF7F7F7F,
	DARKGRAY     = 0xFF3F3F3F,		
	BLACK        = 0xFF000000,
	AZURE        = 0xFFFF7F00,
    VIOLET       = 0xFFFF007F,
    ROSE         = 0xFF7F00FF,
    ORANGE       = 0xFF007FFF,
    CHARTREUSE   = 0xFF00FF7F,
    SPRING_GREEN = 0xFF7FFF00,
    CYAN         = 0xFFFFFF00,
    MAGENTA      = 0xFFFF00FF,
    YELLOW       = 0xFF00FFFF,
};

void Place(OSL_IMAGE *image, int x, int y){
    image->x = x;
    image->y = y;
}

void PauseGame(bool &quit);

int MISSING_FILES(int type);

int collision(OSL_IMAGE *img1,float img1posX, float img1posY, OSL_IMAGE *img2, float img2posX, float img2posY);

int BLOX2(const short gameType);

int main(int argc, char* argv[]);

#include "engine/controller.h"

#include "engine/stats.h"

#include "engine/ai.h"

#include "engine/enemy.h"

#include "engine/bullet.h"

#include "engine/player.h"

#include "engine/game.h"

#include "engine/menu.h"


